<?php

namespace IDock\Insurance\HBIC\Request;

use IDock\Insurance\HBIC\Response\CancelOrderResponse;
use IDock\Insurance\HBIC\Response\CommonResponse;
use IDock\Insurance\HBIC\Response\InsuranceOrderQueryResponse;
use IDock\Insurance\HBIC\Response\InsurancePayUrlResponse;
use IDock\Insurance\HBIC\Response\RenewalInquiryResponse;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;

/**
 * 获取支付链接接口
 */
class InsurancePayUrlRequest extends AllHBICRequest
{
    public $requestType = 'payUrl';

    protected $response = InsurancePayUrlResponse::class;

    protected $urlTip = '获取支付链接接口';

    /**
     * @var PolicyPaymentVisitor $visitor
     */
    protected $visitor;


    public function generate(): array
    {
        $arr = [
            'baseInfo' => [
                'businessNo' => $this->visitor->inquiryNo,
                'riskName' => '车险保费',
                'totalPremium' => $this->visitor->argc['totalPremium'] ?? 0,
                'returnURL' => '',
                'notifyURL' => 'https://a.bxt.freeradio.cn/insuranceDockAsy/HBIC',
                'invokeURL' => '',
                'optional' => '',
            ]
        ];
        if(!empty($this->visitor->argc['nonCarApplyNo'])){
            $arr = [
                'baseInfo' => [
                    [
                        'businessNo' => $this->visitor->inquiryNo,
                        'riskName' => '车险保费',
                        'totalPremium' => $this->visitor->argc['totalPremium'] ?? 0,
                        'returnURL' => '',
                        'notifyURL' => 'https://a.bxt.freeradio.cn/insuranceDockAsy/HBIC',
                        'invokeURL' => '',
                        'optional' => '',
                    ],
                    [
                        'businessNo' => $this->visitor->argc['nonCarApplyNo'],
                        'riskName' => '驾意险险保费',
                        'totalPremium' => $this->visitor->argc['nonCarPremium'] ?? 0,
                        'returnURL' => '',
                        'notifyURL' => 'https://a.bxt.freeradio.cn/insuranceDockAsy/HBIC',
                        'invokeURL' => '',
                        'optional' => '',
                    ]
                ],
            ];
        }

        return $arr;
    }




}
